package com.kerrykidz.sales.dao.model;

import java.util.Date;

/**
 * 
 * @Description 订单相关操作记录
 * @author QUINN
 * @date 2014年8月27日下午4:08:04
 */
public class OrderRecord implements Comparable<OrderRecord> {

	public OrderRecord() {

	}

	/**
	 * 支付记录
	 * 
	 * @param payment
	 */
	public OrderRecord(PosOrderPaymentEntity payment) {
		this.operator = payment.getOperator();
		this.opeTime = payment.getPayTime();
		this.price = payment.getAmount();
		this.payMethod = payment.getPayMethod();
		this.opeDesc = "收银";
	}

	/**
	 * 消费记录
	 * 
	 * @param ret
	 */
	public OrderRecord(PosOrderEntity ret) {
		this.operator = ret.getOperator();
		this.opeTime = ret.getOperateTime();
		this.id = ret.getPkOrderId();
		this.price = ret.getAmount();
		this.opeDesc = "退货";
	}

	private String operator;
	private Date opeTime;
	private Double price;
	private String payMethod;
	private String id;
	private String opeDesc;

	public String getOperator() {
		return operator;
	}

	public void setOperator(String operator) {
		this.operator = operator;
	}

	public Date getOpeTime() {
		return opeTime;
	}

	public void setOpeTime(Date opeTime) {
		this.opeTime = opeTime;
	}

	public Double getPrice() {
		return price;
	}

	public void setPrice(Double price) {
		this.price = price;
	}

	public String getPayMethod() {
		return payMethod;
	}

	public void setPayMethod(String payMethod) {
		this.payMethod = payMethod;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getOpeDesc() {
		return opeDesc;
	}

	public void setOpeDesc(String opeDesc) {
		this.opeDesc = opeDesc;
	}

	@Override
	public int compareTo(OrderRecord o) {
		Date d1 = o.getOpeTime();
		long l1 = d1.getTime();
		long l2 = this.opeTime == null ? 0 : this.opeTime.getTime();
		return (int) (l2 - l1);
	}

}
